package com.platform.hjt.sys.model;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Min;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * SysDept entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "sys_dept")
public class SysDept implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -7419110758319865895L;
	private String sysDeptId;
	private SysDept sysDept;
	private SysUserInfo sysUserInfo;
	private SysCompanyInfo sysCompanyInfo;
	@NotBlank(message="部门名称不能为空")
	@Length(max=100, message="名称长度不能超过100个字")
	private String deptName;
	
	@Length(max=100, message="部门编码长度不能超过100个字")
	private String deptCode;
	
	private Timestamp createTime;
	private Boolean isDel;
	@Min(value=0, message="只能输入数字")
	private Integer sortIndex;

	// Constructors

	/** default constructor */
	public SysDept() {
	}

	/** minimal constructor */
	public SysDept(String sysDeptId) {
		this.sysDeptId = sysDeptId;
	}

	/** full constructor */
	public SysDept(String sysDeptId, SysDept sysDept, SysUserInfo sysUserInfo,
			SysCompanyInfo sysCompanyInfo, String deptName,
			Timestamp createTime, Boolean isDel, Integer sortIndex) {
		this.sysDeptId = sysDeptId;
		this.sysDept = sysDept;
		this.sysUserInfo = sysUserInfo;
		this.sysCompanyInfo = sysCompanyInfo;
		this.deptName = deptName;
		this.createTime = createTime;
		this.isDel = isDel;
		this.sortIndex = sortIndex;
	}

	// Property accessors
	@Id
	@GenericGenerator(name="systemUUID",strategy="uuid")
	@GeneratedValue(generator="systemUUID")
	@Column(name = "sys_dept_id", unique = true, nullable = false, length = 32)
	public String getSysDeptId() {
		return this.sysDeptId;
	}

	public void setSysDeptId(String sysDeptId) {
		this.sysDeptId = sysDeptId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "super_dept_id")
	public SysDept getSysDept() {
		return this.sysDept;
	}

	public void setSysDept(SysDept sysDept) {
		this.sysDept = sysDept;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "dept_leader")
	public SysUserInfo getSysUserInfo() {
		return this.sysUserInfo;
	}

	public void setSysUserInfo(SysUserInfo sysUserInfo) {
		this.sysUserInfo = sysUserInfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sys_company_info")
	public SysCompanyInfo getSysCompanyInfo() {
		return this.sysCompanyInfo;
	}

	public void setSysCompanyInfo(SysCompanyInfo sysCompanyInfo) {
		this.sysCompanyInfo = sysCompanyInfo;
	}

	@Column(name = "dept_name", length = 200)
	public String getDeptName() {
		return this.deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	@Column(name = "create_time", length = 19)
	public Timestamp getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	@Column(name = "is_del")
	public Boolean getIsDel() {
		return this.isDel;
	}

	public void setIsDel(Boolean isDel) {
		this.isDel = isDel;
	}

	@Column(name = "sort_index")
	public Integer getSortIndex() {
		return this.sortIndex;
	}

	public void setSortIndex(Integer sortIndex) {
		this.sortIndex = sortIndex;
	}
	
	@Column(name = "dept_code")
	public String getDeptCode() {
		return deptCode;
	}

	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}


}